package com.dingwei.superiordiary.adapter.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.dingwei.superiordiary.R;
import com.dingwei.superiordiary.bean.ServiceLogBean;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.lihao.baselibrary.base.BaseActivity;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created time 2018/2/27.
 * Creator 南柯一梦丶 on
 * Personal signature 余生还长 何必慌张
 * Page description :
 */

public class ServiceLogAdapter extends RecyclerArrayAdapter<ServiceLogBean.DataBean.LogBean> {
    public ServiceLogAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new WaitAuditHolder(parent);
    }

    class WaitAuditHolder extends BaseViewHolder<ServiceLogBean.DataBean.LogBean> {

        @Bind(R.id.view)
        View view;
        @Bind(R.id.tv)
        TextView tv;

        public WaitAuditHolder(ViewGroup parent) {
            super(parent, R.layout.item_wait_audit);
            ButterKnife.bind(this, itemView);

        }

        @Override
        public void setData(ServiceLogBean.DataBean.LogBean data) {
            super.setData(data);

            if (getDataPosition() == 0){
                view.setBackground(BaseActivity.context.getResources().getDrawable(R.drawable.theme_circle));
                tv.setTextColor(BaseActivity.context.getResources().getColor(R.color.theme_color));
            }else {
                view.setBackground(BaseActivity.context.getResources().getDrawable(R.drawable.gray_circle));
                tv.setTextColor(BaseActivity.context.getResources().getColor(R.color.text_color_gray));
            }
            tv.setText(data.addtime+" "+data.description);

        }
    }
}
